import 'package:blue_plugin_example/base/get_extension.dart';
import 'package:blue_plugin_example/res/button_style.dart';
import 'package:blue_plugin_example/res/colors.dart';
import 'package:blue_plugin_example/res/style.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'dialog_base.dart';

//蓝牙未打开的提示
class BlueOffDialog extends StatefulWidget {
  late Function(String error)? nextTap;
  late VoidCallback? backTap;

  BlueOffDialog({
    Key? key,
    this.backTap,
    this.nextTap,
  }) : super(key: key);

  @override
  State<BlueOffDialog> createState() => _BlueOffDialogState();
}

class _BlueOffDialogState extends State<BlueOffDialog> {
  @override
  Widget build(BuildContext context) {
    return BaseDialog(
        child: Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        Box.vBox16,
        const Text(
          "提示",
          style: Styles.style_black_18_bold500,
        ),
        Box.vBox16,
        const Text(
          "需要打开蓝牙",
          style: Styles.style_black_16,
        ),
        Box.vBox16,
        // DividerStyle.divider1Half_black_text_color_gry_wid,
        DividerStyle.divWid,
        SizedBox(
            width: double.infinity,
            height: 50,
            child: Row(
              children: [
                Flexible(
                  fit: FlexFit.tight,
                  flex: 1,
                  child: TextButton(
                    style: ButtonStyles.getNoShapeStyle(),
                    onPressed: () {
                      Get.dismiss();
                      widget.backTap!();
                    },
                    child: const Text(
                      "关闭",
                      style: TextStyle(
                          fontSize: 16, color: ColorStyle.text_color_1E1F20),
                    ),
                  ),
                ),
                DividerStyle.divHei,
                Flexible(
                  fit: FlexFit.tight,
                  flex: 1,
                  child: TextButton(
                    style: ButtonStyles.getNoShapeStyle(),
                    onPressed: () {
                      widget.nextTap!("");
                    },
                    child: const Text(
                      "打开",
                      style: TextStyle(
                          fontSize: 16, color: ColorStyle.theme_text_color),
                    ),
                  ),
                )
              ],
            ))
      ],
    ));
  }
}
